package com.sambo.inspection.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sambo.inspection.R;
import com.sambo.inspection.activity.support.BaseActivity;
import com.sambo.inspection.bean.InspectionPointBean;

public class InspectionPointDetailsActivity extends BaseActivity implements View.OnClickListener {
    ImageView ivBack;
    TextView tvInspectionPointName;
    TextView tvInspectionPointUmber;
    TextView tvQuipmentType;
    TextView tvLocation;
    TextView tvPlace;
    TextView tvDetailedDescription;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_inspection_point_details);

        ivBack = findViewById(R.id.iv_back);
        tvInspectionPointName = findViewById(R.id.tv_inspection_point_name);
        tvInspectionPointUmber = findViewById(R.id.tv_inspection_point_umber);
        tvQuipmentType = findViewById(R.id.tv_quipment_type);
        tvLocation = findViewById(R.id.tv_location);
        tvPlace = findViewById(R.id.tv_place);
        tvDetailedDescription = findViewById(R.id.tv_detailed_description);

        InspectionPointBean bean = (InspectionPointBean) getIntent().getSerializableExtra("model");
        tvInspectionPointName.setText(bean.getName());
        tvInspectionPointUmber.setText(String.valueOf(bean.getCode()));
        if (TextUtils.equals("1", bean.getDeviceType())) {
            tvQuipmentType.setText("流量计");
        } else if (TextUtils.equals("2", bean.getDeviceType())) {
            tvQuipmentType.setText("压力表");
        } else if (TextUtils.equals("3", bean.getDeviceType())) {
            tvQuipmentType.setText("水表");
        } else if (TextUtils.equals("4", bean.getDeviceType())) {
            tvQuipmentType.setText("阀门");
        } else if (TextUtils.equals("5", bean.getDeviceType())) {
            tvQuipmentType.setText("普通节点");
        } else if (TextUtils.equals("6", bean.getDeviceType())) {
            tvQuipmentType.setText("其他");
        }
        tvLocation.setText(bean.getLocation());
        tvPlace.setText(bean.getAddress());
        tvDetailedDescription.setText(bean.getDescription());

        ivBack.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
        }
    }
}
